home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1996 #6 / Amiga Plus CD - 1996 - No. 06.iso / pd / programmierung / proasm / routines / diskobjectsupport.r < prev    next >
Text File  |  1993-04-11  |  5KB  |  168 lines

  1. ****************************************************************************
  2. *                                        *
  3. *                  ****   DiskObject Support  ****                *
  4. *                                        *
  5. *    Author        René Eberhard                        *
  6. *    Version        0.20                            *
  7. *    Last Revision    11-Apr-93                        *
  8. *    Identifier    dobjs_defined                        *
  9. *       Prefix        dobjs_ (diskobjectsupport)                *
  10. *                               ¯   ¯ ¯   ¯                         *
  11. *                                         *
  12. *-----------------------------[ UPDATES ]----------------------------------*
  13. *                                        *
  14. *    -REB!    26.07.1992    Start this Project               *
  15. *    -REB!    11-Apr-93    Macro -> Routine / added some new features *
  16. *                                        *
  17. ****************************************************************************
  18. *---------------------------[ Functions ]----------------------------------*
  19. *                                        *
  20. * - GetDiskObject_WB, GetToolType                        *
  21. *                                        *
  22. *---------------------------[ UPDATES ]------------------------------------*
  23. *                                            *
  24. *---------------------------[ COMMENT ]------------------------------------*
  25. * - FreeDiskObject is NOT implemented, because it is to simple            *
  26. *                                            *
  27. ****************************************************************************
  28. ;---------------------------------------------------------------------------
  29.     IFND    dobjs_defined
  30. dobjs_defined    SET    1
  31.  
  32.  
  33. ;---------------[ Some includes ]-------------------------------------------
  34.  
  35.     ;INCLUDE    "special/DiskObjectSupport.i"
  36.         
  37. ;---------------------------------------------------------------------------
  38.  
  39.     IFND    USE_NEWROUTINES
  40.     NEED_    GetDiskObject_WB
  41.     NEED_    GetDiskObject_CLI
  42.     NEED_    GetToolType
  43.     ENDIF
  44.         
  45. ;---------------------------------------------------------------------------
  46. ****************************************************************************
  47. *                                        *
  48. * NAME    : GetDiskObject_CLI                            *
  49. *                                        *
  50. * SYNOPSIS:                                     *
  51. *       Result = GetDiskObject_CLI (Name)                    *
  52. *       D0.L                        A0.L                       *
  53. *                                        *
  54. * FUNCTION: Get the diskobject with a optional name.                *
  55. *                                        *
  56. * RESULT  : DiskObject or FALSE                         *
  57. *                                        *
  58. * COMMENT : This function takes the diskobject with a given name.         *
  59. *        If there was a WB startup, it takes the diskobjekt via        *
  60. *        GetDiskObject_WB().                             *
  61. *        CLI startup needs cws_homedir.                    *
  62. *        Save the cli_CommandName before detaching.                *
  63. *                                        *
  64. ****************************************************************************
  65.     IFD    xxx_GetDiskObject_CLI
  66. GetDiskObject_CLI:
  67.     NEED_    GetDiskObject_WB
  68.  
  69.     tst.b    cws_wbstartup        ;Startup from WB?
  70.     bne.s    GetDiskObject_WB    ;Yes, get diskobject via wbmsg
  71.  
  72.     PUSHM.L    d1-a6
  73.  
  74.     move.l    a0,a4            ;Store name
  75.  
  76.     move.l    DosBase(PC),a6
  77.     move.l    cws_homedir,d1        ;Sorry for reloc
  78.     JSRLIB_    CurrentDir        ;CD homedir
  79.     move.l    d0,-(SP)        ;Store old lock
  80.  
  81.     move.l    a4,a0            ;Restore Name
  82.  
  83.     move.l    IconBase(PC),a6        ;IconBase
  84.     JSRLIB_    GetDiskObject
  85.     move.l    d0,a4            ;Store DiskObject
  86.  
  87.     move.l    DosBase(PC),a6
  88.     move.l    (SP)+,d1        ;Restore old lock
  89.     JSRLIB_    CurrentDir        ;CD old dir
  90.  
  91.     move.l    a4,d0            ;Restore DiskObject
  92.  
  93. \Exit:    POPM.L    d1-a6
  94.     rts
  95.  
  96.     ENDC
  97. ;---------------------------------------------------------------------------
  98. ****************************************************************************
  99. *                                        *
  100. * NAME    : GetDiskObject_WB                            *
  101. *                                        *
  102. * SYNOPSIS:                                     *
  103. *       Result = GetDiskObject_WB ()                        *
  104. *       D0.L                                               *
  105. *                                        *
  106. * FUNCTION: Get the diskobject.                            *
  107. *                                        *
  108. * RESULT  : DiskObject or FALSE                         *
  109. *                                        *
  110. * COMMENT : This function takes the diskobject only if the program has        *
  111. *        been started from the workbench.                     *
  112. *                                        *
  113. *        dc.b    cws_wbstartup,-1    ;-1 for WB, 0 for CLI        *
  114. *                                        *
  115. ****************************************************************************
  116.     IFD    xxx_GetDiskObject_WB
  117. GetDiskObject_WB:
  118.     PUSHM.L    d1-a6
  119.  
  120.     tst.b    cws_wbstartup        ;No WB startup
  121.     beq.s    \Exit
  122.  
  123.     move.l    IconBase(PC),a6        ;IconBase
  124.     move.l    cws_wbmessage,d0        
  125.     beq.s    \Exit            ;No WB startup
  126.  
  127.     move.l    d0,a0
  128.     move.l    sm_ArgList(a0),a0    ;sm_ArgList 
  129.     move.l    wa_Name(a0),d0        ;Pointer to name
  130.     beq.s    \Exit            ;No name
  131.     move.l    d0,a0            ;Name into A0.L
  132.     JSRLIB_    GetDiskObject
  133.  
  134. \Exit:    POPM.L    d1-a6
  135.     rts
  136.  
  137.     ENDC
  138. ;---------------------------------------------------------------------------
  139. ****************************************************************************
  140. *                                        *
  141. * NAME    : GetToolType                                *
  142. *                                        *
  143. * SYNOPSIS:                                     *
  144. *       Value = FindToolType    (DiskObject,TypeName)                *
  145. *       D0.L                     A0.L        A1.L                *
  146. *                                        *
  147. * FUNCTION: Find the value of a ToolType variable.                *
  148. *                                        *
  149. * RESULT  : Pointer to string that is the value bound to TypeName        *
  150. *           or FALSE if TypeName is not in the ToolTypeArray            *
  151. *                                        *
  152. ****************************************************************************
  153.     IFD    xxx_GetToolType
  154. GetToolType:
  155.  
  156.     PUSHM.L    d1-a6
  157.     move.l    IconBase(PC),a6        ;IconBase
  158.     move.l    do_ToolTypes(a0),a0    ;Pointer to ToolTypeArray
  159.     JSRLIB_    FindToolType
  160.     POPM.L    d1-a6
  161.  
  162.         ENDC
  163. ;---------------------------------------------------------------------------
  164.  
  165.  
  166.         ENDC
  167. ;---------------------------------------------------------------------------
  168.